<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="jobportal.Dbconn"%>
<%@include file="header.jsp" %>
<form name="form1" action="admin_mang.jsp" method="post">
    <table width="100%" height="13%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="100%" height="*" valign="top">
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
                    <tr class="tablemainheading">
                        <td width="739" height="15" class="deepbluetext"><span style="padding: 10px;">


                            </span></td>
                    </tr>
                    <tr class="tablemainheading">
                        <td height="15" class="deepbluetext">&nbsp;</td>
                    </tr>
                    <tr class="tablemainheading">
                        <td height="15" align="center" valign="top" class="deepbluetext"><table width="100%" style="border: 1px solid rgb(169, 211, 225);" align="center" cellpadding="0" cellspacing="1">
                                <tr >
                                    <td height="19" colspan="6" class="bluebg"><div align="left"><strong>Admin Members List </strong><span class="login">
                                            </span></div></td>
                                    <td height="19" colspan="2" align="center" class="bluebg"><a href="addadminmember.jsp" class="menu"><img src="../images/users_add.png"  border="0">Add New Member</a></td>
                                </tr>
                                <tr class="tabledetailsheading" style="background-color: #4297d7">
                                    <td width="45" class="bluebg" style="padding-left:2px;"><strong>Sno.</strong></td>
                                    <td width="143" height="19" align="left" class="bluebg" style="padding-left:2px;"><strong>Username</strong></td>
                                    <td width="186" align="left" class="bluebg" style="padding-left:2px;"><strong>Email</strong></td>
                                    <td width="212" align="left" class="bluebg" style="padding-left:2px;"><strong>Last Login </strong></td>
                                    <td width="212" align="left" class="bluebg" style="padding-left:2px;"><strong>privilege </strong></td>
                                    <td width="105" align="center" class="bluebg" style="padding-left:2px;"><strong>Status</strong></td>
                                    <td colspan="2" align="center" class="bluebg" style="padding-left:2px;"><strong>Action</strong></td>
                                </tr>

                                <%
                                    Connection con = null;
                                    Statement st = null;
                                    String username = (String) session.getAttribute("username");


                                    try {
                                        con = Dbconn.getConn();
                                        st = con.createStatement();
                                        ResultSet rs;

                                        String sql = "select * from admin";

                                        rs = st.executeQuery(sql);
                                        for (int i = 1; rs.next(); i++) {

                                %>
                                <tr class="tabledetails">
                                    <td valign="middle" bgcolor="#E8E8E8" class="deepbluetext" style="padding-left:2px;"><%=i%></td>
                                    <td align="left" valign="middle" bgcolor="#E8E8E8" class="deepbluetext" style="padding-left:2px;"><%=rs.getString("name")%></td>
                                    <td align="left" valign="middle" bgcolor="#E8E8E8" class="deepbluetext" style="padding-left:2px;"><%=rs.getString("email")%></td>
                                    <td align="left" valign="middle" bgcolor="#E8E8E8" class="deepbluetext"style="padding-left:2px;"><%=rs.getString("lastlogin")%></td>
                                     <td align="left" valign="middle" bgcolor="#E8E8E8" class="deepbluetext"style="padding-left:2px;"><%=rs.getString("prev")%></td>

                                    <td align="center" valign="middle" bgcolor="#E8E8E8" class="deepbluetext" style="padding-left:2px; text-transform:capitalize;">
                                        <%if (rs.getString("status").equalsIgnoreCase("active")) {%>
                                        <font color='#006600'>active </font>
                                        <%} else {%>
                                        <font color="red">Not Active </font>
                                        <%}%>
                                    </td>
                                    <td width="79" align="center" valign="middle" bgcolor="#E8E8E8" style="padding-left:2px;"><a href="updateinfo.jsp?admemid=<%=rs.getString("userid")%>"><img src="../images/user_edit.png"  border="0"></a></td>
                                    <td width="77" align="center" valign="middle" bgcolor="#E8E8E8" class="deepbluetext" style="padding-left:2px;"><a href="DeleteAdmin?adminid=<%=rs.getString("userid")%>" onClick="javascript: return confirm('All the  information related to this Member will be deleted.\n\nDo you really want to delete the Member?');"><img src="../images/user_remove.png"  border="0"></a></td>
                                </tr>
                                <%

                                        }
                                    } catch (Exception e) {
                                        out.println(e);
                                    }

                                %>
                            </table></td>
                    </tr>

                </table>    </td>
        </tr>
        <%if (request.getAttribute("msg") != null) {%>
        <tr class="tablemainheading"><td class="deepbluetext"><%=request.getAttribute("msg")%></td></tr>
        <%}%>
    </table>
</form>
<%
    if (request.getAttribute("msg") != null) {
%>
<div id="message"  title="Message">
    <%
        out.println(request.getAttribute("msg"));
    %>
</div>
<%
        request.removeAttribute("msg");
    }
%>
<%
    if (request.getParameter("msg") != null) {
%>
<div id="message"  title="Message">
    <%
        out.println(request.getParameter("msg"));
    %>
</div>
<%
      
    }
%>

<%@include file="footer.jsp" %>